
export default {
	state:{
		roleRight:{
		  deleteCar:false,         //车辆删除

      carSale:false,           //车辆特卖

      reCheck:false,           //申请复检

      holdCar:false,           //车辆抵押

      detentionCar:false,      //车辆解押

      applyInStock:false,      //申请入库

      saleOutStock:false,      //销售出库

      CarGrounding:false,      //车辆上架

      CarUnShelve:false,       //车辆下架

      carBook:false,           //车辆预定

      bookDetail:false,        //预定详情

      bindRFID:false,          //绑定RFID

      changeRFID:false,        //更换RFID

      printPriceTag:false,     //打印价签

      printCertificate:false   //打印证书
    }
	},
	mutations:{
	  getRoleRight(state,roleId){
      for(var i in state.roleRight){                //初始化权限
        state.roleRight[i] = false
      }
      console.log(roleId)
	    switch (roleId) {
        case 1:                                    //总公司管理员
          for(var i in state.roleRight){
            state.roleRight[i] = true
          }
          break;
        case 10:                                    //总公司管理员
          for(var i in state.roleRight){
            state.roleRight[i] = true
          }
          break;
        case 11:                                    //总公司审核员
          state.roleRight.CarUnShelve = true;
          break;
        case 30:                                    //市场管理员
          state.roleRight.deleteCar = true;
          state.roleRight.bindRFID = true;
          state.roleRight.changeRFID = true;
          state.roleRight.printPriceTag = true;
          state.roleRight.printCertificate = true;
          break;
        case 31:                                     //市场员工
          state.roleRight.deleteCar = true;
          state.roleRight.bindRFID = true;
          state.roleRight.changeRFID = true;
          state.roleRight.printPriceTag = true;
          state.roleRight.printCertificate = true;
          break;
        case 40:                                      //车商
          for(var i in state.roleRight){
            state.roleRight[i] = true
          }
          state.roleRight.holdCar = false;
          state.roleRight.detentionCar = false;
          state.roleRight.bindRFID = false;
          state.roleRight.changeRFID = false;
          break;
        case 41:                                      //车商员工
          for(var i in state.roleRight){
            state.roleRight[i] = true
          }
          state.roleRight.holdCar = false;
          state.roleRight.detentionCar = false;
          state.roleRight.bindRFID = false;
          state.roleRight.changeRFID = false;
          break;
      }
    }
	}
}
